package com.csr.csrcheck.service.impl;

import com.csr.csrcheck.mapper.FeedbackMapper;
import com.csr.csrcheck.pojo.Feedback;
import com.csr.csrcheck.service.FeedbackService;
import com.csr.csrcheck.service.ex.CompanyException;
import com.csr.csrcheck.service.ex.InsertException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FeedbackServiceImpl implements FeedbackService {
    @Resource
    private FeedbackMapper feedbackMapper;

    public void addfeedback(Feedback feedback) {
        if (feedback.getContent().equals("") || feedback.getInformation().equals(""))
            throw new CompanyException("");
                    Integer row = this.feedbackMapper.addfeedback(feedback);
        if (row.intValue() != 1)
            throw new InsertException("");
    }

    public List<Feedback> getfeedback() {
        List<Feedback> list = null;
        try {
            list = this.feedbackMapper.getfeedback();
        } catch (Exception e) {
            throw new CompanyException("");
        }
        return list;
    }
}

